import request from '@/utils/request'
import qs from 'qs'

// 获取所有内容
export function getContentList (pageNumber, pageSize,articleId) {
  console.log(request.baseURL)
  return request({
    url: '/cms/article_content/list',
    method: 'get',
    params: {
      pageNumber,
      pageSize,
      articleId
    }
  })
}


// 添加内容
export function addContent (data) {
  return request({
    url: '/cms/article_content/save',
    method: 'post',
    data: qs.stringify(
      data
    )
  })
}

// 删除内容
export function deleteContentes (ids) {
  return request({
    url: '/cms/article_content/delete',
    method: 'post',
    data: qs.stringify({
      ids
    }, {indices: false})
  })
}

// 编辑内容
export function updateContent (content) {
  return request({
    url: '/cms/article_content/update',
    method: 'post',
    data: qs.stringify({
      id: content.id,
      name: content.name,
      languageId: content.languageId,
      title: content.title,
      introduce: content.introduce,
      details: content.details,
      photo: content.fileSrc,
      outChain: content.outChain,
    }, {indices: false})
  })
}
